<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk">

<f:view>
<f:loadBundle var="messages" basename="messages"/>

<head>
    <title>#{messages['conteudoForm.title']}</title>
    <style type="text/css">
        .jscalendar-DB-div-style {
            position: absolute;
            margin-top: -69px;
            margin-left: -408px;
        }
    </style>
</head>

<h:messages errorClass="error" layout="table" style="width: 100%"/>

<p>Please fill in example's information below:</p>

<h:form id="conteudoForm">
<h:inputHidden value="#{conteudoForm.conteudo.id}">
    <f:convertNumber/>
</h:inputHidden>
<h:panelGrid columns="3" styleClass="detail" columnClasses="label">

	<h:outputLabel for="categoria" value="#{messages['conteudo.categoria']}"/>
    <h:selectOneMenu value ="#{conteudoForm.categoriaId}" id="categoria" required="true" 
    requiredMessage="Campo Categoria Obrigatorio">
    	<f:selectItems value="#{conteudoForm.listaDeCategorias}"/>
    </h:selectOneMenu>
    <!--  <h:message for="categoria" styleClass="errorMessage"/>-->
    
    <h:outputLabel for="titulo" value="#{messages['conteudo.titulo']}"/>
    <h:inputText value="#{conteudoForm.conteudo.titulo}" id="titulo" required="true"
     requiredMessage="Campo Titulo Obrigatorio">
     <f:validateLength maximum="100"/>
     </h:inputText>
    <!--  <h:message for="titulo" styleClass="errorMessage"/>-->

    <h:outputLabel for="descricao" value="#{messages['conteudo.descricao']}"/>    
    <h:inputText value="#{conteudoForm.conteudo.descricao}" id="descricao" required="true"
    requiredMessage = "Campo Descricao Obrigatorio">
    <f:validateLength maximum="255"/>
    </h:inputText>	
    <!--  <h:message for="descricao" styleClass="errorMessage"/>-->
    
    <h:outputLabel for="tags" value="#{messages['conteudo.tags']}"/>    
    <h:inputText value="#{conteudoForm.conteudo.tags}" id="tags" required="true"
    requiredMessage = "Campo Tags Obrigatorio">
    <f:validateLength maximum="255"/>
    </h:inputText>
    <!--  <h:message for="tags" styleClass="errorMessage"/>-->
    
    <h:outputLabel for="url" value="#{messages['conteudo.url']}"/>    
    <h:inputText value="#{conteudoForm.conteudo.url}" id="url" required="true"
    requiredMessage = "Campo Url Obrigatorio">
    <f:validateLength maximum="255"/>
    </h:inputText>
    <!--  <h:message for="url" styleClass="errorMessage"/> -->

    <h:outputLabel for="datacriacao" value="#{messages['conteudo.dataCriacao']}"/>
    <t:inputCalendar monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" id="dataCriacao"
            currentDayCellClass="currentDayCell" value="#{conteudoForm.conteudo.dataCriacao}" 
            renderAsPopup="true" addResources="true"/>
    <!-- <h:message for="datacriacao" styleClass="errorMessage"/> -->
    <h:inputHidden value=""/>
    
    <h:panelGroup>
        <h:commandButton value="Enviar" action="#{conteudoForm.save}" id="save" styleClass="button"/>
    <c:if test="${not empty conteudoForm.id}">
    <h:commandButton onclick="return confirm('Confirma Exclusao?');"
         value="Deletar" action="#{conteudoForm.delete}" id="delete" styleClass="button"/>
    </c:if>
        <h:commandButton value="Cancelar" action="cancel" immediate="true" id="cancel" styleClass="button"/>
    </h:panelGroup>
    <h:inputHidden value=""/>
</h:panelGrid>
</h:form>

<script type="text/javascript">
    Form.focusFirstElement(document.forms['conteudoForm']);
</script>

</f:view>
</html>